//
//  MoneyDetailTableViewCell.m
//  CarCare
//
//  Created by ileo on 15/1/8.
//  Copyright (c) 2015年 baozun. All rights reserved.
//

#import "MoneyDetailTableViewCell.h"

#define CELL_HEIGHT 55

@interface MoneyDetailTableViewCell()

@property (nonatomic, strong) UILabel *titleL;
@property (nonatomic, strong) UILabel *timeL;
@property (nonatomic, strong) UILabel *numL;

@property (nonatomic, strong) UIImageView *imageV;

@end

@implementation MoneyDetailTableViewCell

+(CGFloat)cellHeight{
    return CELL_HEIGHT;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [[[UIView viewWithFrame:CGRectMake(0, CELL_HEIGHT-0.5, __MAIN_WIDTH, 0.4)] resetBackgroundColor:[Theme lineColor]] setupOnView:self];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.titleL = [Factory labelWithFrame:CGRectMake(60 * __MAIN_RATIO_375, 10, 250, 20) font:FONT_DEFAULT_Light(15) text:@"" textColor:[UIColor colorWithHexString:@"#181818"] onView:self textAlignment:NSTextAlignmentLeft];

        self.timeL = [Factory labelWithFrame:CGRectMake(60 * __MAIN_RATIO_375, self.titleL.bottom, 250, 20) font:FONT_Num(12) text:@"" textColor:[UIColor colorWithHexString:@"#929292"] onView:self textAlignment:NSTextAlignmentLeft];

        self.numL = [Factory labelWithFrame:CGRectMake(__MAIN_WIDTH - 105, 17, 90, 20) font:FONT_Num(15) text:@"" textColor:[Theme wordColor] onView:self textAlignment:NSTextAlignmentRight];

        self.imageV = [Factory imageViewWithFrame:CGRectMake(0, 0, 27, 27) image:nil onView:self];
        self.imageV.center = CGPointMake(35 * __MAIN_RATIO_375, CELL_HEIGHT/2);
    }
    return self;
}

-(void)setModel:(MoneyDetailModel *)model{
    _model = model;
    self.titleL.text = model.TYPENOTE;
    self.timeL.text = model.showTime;
    if (model.NUM > 0) {
        self.numL.text = [NSString stringWithFormat:@"+%zd",model.NUM];
    }else{
        self.numL.text = [NSString stringWithFormat:@"%zd",model.NUM];
    }
    self.imageV.image = ImageNamed(model.imageStr);
}

@end
